const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()

  return `${year}年${month}月${day}日`
}

const formatTimeSplit = date => {
  const year = date.getFullYear()
  const month = parseInt(date.getMonth() + 1) > 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)
  const day = parseInt(date.getDate()) > 10 ? date.getDate(): '0' + date.getDate()

  return `${year}-${month}-${day}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

module.exports = {
  formatTime,
  formatNumber,
  formatTimeSplit
}
